<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of databaseOperationClass
 *
 * @author Mark
 */
include ("../Connections/SCMS.php");
class databaseOperationClass {
    function insertIntoStock($id,$name, $number, $cost,$property,$stockno){
       $query = mysql_query("INSERT INTO scms.stock (sid,sname, snumber, scost, sproperty, stockno)
	              VALUES ($id,'$name', $number, $cost,'$property',$stockno);");
    if($query){
        return true;
		  exit;
    }
    else{
        return false;
		  exit;
    }
    }
	 
    function deleteFromStock($id){
	 $query = mysql_query("delete from SCMS.stock where sid ='$id';");
    		if($query){
        		return true;
				exit;
    		}
    		else{
        		return false;
				exit;
    		}
	 }	
	  
    function insertIntoRawMaterial($id, $name, $number, $cost,$property,$stockno){
       $query = mysql_query("INSERT INTO scms.rawmaterial (rid, rname, rnumber, rcost, rproperty, rtockno)
	              VALUES ($id, '$name', $number, $cost,'$property',$stockno);");
    		if($query){
        		return true;
				exit;
    		}
    		else{
        		return false;
				exit;
    		}	 
    }	
	 
	 function deleteFromRawMaterial($id){
	 $query = mysql_query("delete from SCMS.rawmaterial where rid ='$id';");
    		if($query){
        		return true;
				exit;
    		}
    		else{
        		return false;
				exit;
    		}
	 }	
	 
    function insertIntoClient($id, $name, $phone, $email,$remark,$rank){
       $query = mysql_query("INSERT INTO scms.client (cid, cname, cphone, cemail, cremark, rank)
	              VALUES ($id, '$name', $phone, '$email','$remark','$rank');");
    		if($query){
        		return true;
				exit;
    		}
    		else{
        		return false;
				exit;
    		}	 
    }	 
	 
    function deleteFromClient($id){
	 $query = mysql_query("delete from SCMS.client where cid ='$id';");
    		if($query){
        		return true;
				exit;
    		}
    		else{
        		return false;
				exit;
    		}
	 }
	 
	 
    function checkhave($table,$id){
	 $query = mysql_query("select from SCMS.'$table' where rid ='$id';");
    		if($query){
        		return true;
				exit;
    		}
    		else{
        		return false;
				exit;
    		}
	 }

	 
}
?>
